package com.behome.common.core.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.behome.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;
import java.util.List;

public class SysRegion extends BaseEntity {
    /**
    * 区域ID
    */
    @TableId(value = "region_id", type = IdType.INPUT)
    private String regionId;

    /**
    * 父区域ID
    */
    @TableField(value = "parent_region_id")
    private String parentRegionId;

    /**
     * 祖级
     */
    @TableField(value = "ancestors")
    private String ancestors;

    /**
    * 区域名称
    */
    @TableField(value = "name")
    private String name;

    /**
    * 区域级别
    */
    @TableField(value = "level")
    private Integer level;

    /**
    * 别名
    */
    @TableField(value = "alias")
    private String alias;

    /**
    * 经度
    */
    @TableField(value = "longitude")
    private Double longitude;

    /**
    * 纬度
    */
    @TableField(value = "latitude")
    private Double latitude;

    /**
    * 是否子叶节点
    */
    @TableField(value = "is_leaf")
    private Integer isLeaf;

    /**
    * 状态 0 不启用 1启用
    */
    @TableField(value = "status")
    private Integer status;

    /**
    * 创建时间
    */
    @TableField(value = "create_time")
    private Date createTime;

    /**
    * 创建人id
    */
    @TableField(value = "create_user_id")
    private Integer createUserId;

    /**
    * 更新时间
    */
    @TableField(value = "update_time")
    private Date updateTime;

    /**
    * 更新人id
    */
    @TableField(value = "update_user_id")
    private Integer updateUserId;
    @TableField(exist = false)
    private List<SysRegion> children;

    public String getRegionId() {
        return regionId;
    }

    public void setRegionId(String regionId) {
        this.regionId = regionId;
    }

    public String getParentRegionId() {
        return parentRegionId;
    }

    public void setParentRegionId(String parentRegionId) {
        this.parentRegionId = parentRegionId;
    }

    public String getAncestors() {
        return ancestors;
    }

    public void setAncestors(String ancestors) {
        this.ancestors = ancestors;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public String getAlias() {
        return alias;
    }

    public void setAlias(String alias) {
        this.alias = alias;
    }

    public Double getLongitude() {
        return longitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }

    public Double getLatitude() {
        return latitude;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    public Integer getIsLeaf() {
        return isLeaf;
    }

    public void setIsLeaf(Integer isLeaf) {
        this.isLeaf = isLeaf;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Override
    public Date getCreateTime() {
        return createTime;
    }

    @Override
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getCreateUserId() {
        return createUserId;
    }

    public void setCreateUserId(Integer createUserId) {
        this.createUserId = createUserId;
    }

    @Override
    public Date getUpdateTime() {
        return updateTime;
    }

    @Override
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getUpdateUserId() {
        return updateUserId;
    }

    public void setUpdateUserId(Integer updateUserId) {
        this.updateUserId = updateUserId;
    }

    public List<SysRegion> getChildren(){return children;}

    public void setChildren(List<SysRegion> children){this.children = children;}

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("regionId", getRegionId())
                .append("parentRegionId", getParentRegionId())
                .append("ancestors", getAncestors())
                .append("name", getName())
                .append("level", getLevel())
                .append("alias", getAlias())
                .append("longitude", getLongitude())
                .append("latitude", getLatitude())
                .append("isLeaf", getIsLeaf())
                .append("status", getStatus())
                .append("createTime", getCreateTime())
                .append("createUserId", getCreateUserId())
                .append("updateTime", getUpdateTime())
                .append("updateUserId", getUpdateUserId())
                .toString();
    }
}